#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QToolBar>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QToolBar* toolBar1=new QToolBar();
    QToolBar* toolBar2=new QToolBar();
    this->addToolBar(toolBar1);//工具栏可以有多个
    this->addToolBar(Qt::LeftToolBarArea,toolBar2);//设置工具栏初始出现位置
    //设置不允许移动
    toolBar1->setMovable(false);
    //设置允许停靠位置
    toolBar2->setAllowedAreas(Qt::LeftToolBarArea|Qt::RightToolBarArea);

    QAction* action1=new QAction("活动1");
    QAction* action2=new QAction("活动2");
    QAction* action3=new QAction("活动3");
    QAction* action4=new QAction("活动4");

    toolBar1->addAction(action1);
    toolBar1->addAction(action2);
    toolBar2->addAction(action3);
    toolBar2->addAction(action4);

}

MainWindow::~MainWindow()
{
    delete ui;
}

